package com.movie.theatre.web.constant;

import lombok.Getter;

/**
 * @Auther: liwu
 * @Date: 2019/12/24 18:08
 * @Description:
 */
@Getter
public enum MqEnum {

    CINEMA_CLOUD_MQ("CINEMA_CLOUD_TOPIC", "GID_CINEMA_CLOUD_GROUP", "云服务器MQ"),
    CINEMA_LOCAL_MQ("CINEMA_LOCAL_TOPIC", "GID_CINEMA_LOCAL_GROUP", "本地服务器MQ"),

    ;
    private String topic;
    private String group;
    private String remark;

    MqEnum(String topic, String group, String remark) {
        this.topic = topic;
        this.group = group;
        this.remark = remark;
    }


    public static MqEnum getByTopic(String topic) {

        for (MqEnum mq : values()) {
            if (mq.topic.equalsIgnoreCase(topic)) {
                return mq;
            }
        }
        throw new IllegalArgumentException("不支持的topic类型" + topic);
    }

    public static MqEnum getByGroup(String group) {

        for (MqEnum mq : values()) {
            if (mq.group.equalsIgnoreCase(group)) {
                return mq;
            }
        }
        throw new IllegalArgumentException("不支持的GROUP类型" + group);
    }
}
